package com.mall.payment.controller;

import com.alipay.api.AlipayApiException;
import com.mall.common.dto.OrderDTO;
import com.mall.payment.service.AlipayService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author: 谢君臣
 * @Date: 2022/8/15-18:07
 * @version: 1.0
 * @function:
 */
@RestController
@RequestMapping("/payment/alipay")
public class AliPayController {

    @Resource
    private AlipayService alipayService;


    @RequestMapping(value = "/pay",produces = "text/html")
    public String payOrder(@RequestParam("orderId") String orderId){
        try {
            String response = alipayService.payOrder(orderId);
            return response;
        } catch (AlipayApiException e) {
           return "success";
        }
    }

}
